#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ferro2 "problema ao abrir o arquivo.\n"
#define nexistx "nao existe ra.\n"
#define existx "ra encontrado.\n"
#define rax 6
#define espa 3
#define textoent "pk.txt"


char* buscapk(char *str){
  FILE *apt = fopen(textoent,"r");
  if (apt==NULL)
  {
    printf(ferro2);
    return NULL;
  }
  int i;
  char vetor[rax+1];
  char posicao[espa];
  while(!feof(apt)){
    fgets(vetor,rax+1,apt);
    vetor[rax] = '\0';
    //printf("%s\n",vetor);
    i=strcmp(vetor,a);
    //printf("%d\n",i);
    if(i==0){
      printf(existx);
      fgets(posicao,rax+4,apt);
      //printf("%s\n",posicao);
      //system("PAUSE");
      return posicao;
    }
    fgets(vetor,rax+4,apt);

  }
  printf(nexistx);
  //system("PAUSE");
  close(apt);
  return NULL;
}
